package com.flyiu.data.consistency.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Entity
@Table
@EntityListeners(AuditingEntityListener.class)
public class DistributedTransactionPartner {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	
	private String name;
	@Column(length=5000)
	private String context;
	@ManyToOne
	private DistributedTransactionInstance instance;
	
	@CreatedDate
	@Column(name = "create_yime")
	private Date createTime;
	@LastModifiedDate
	@Column(name = "update_time")
	private Date updateTime;
	
	@Enumerated(value = EnumType.STRING)
	private DistributedTransactionState transactionState;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getContext() {
		return context;
	}

	public void setContext(String context) {
		this.context = context;
	}


	
	
	public DistributedTransactionInstance getInstance() {
		return instance;
	}

	public void setInstance(DistributedTransactionInstance instance) {
		this.instance = instance;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public DistributedTransactionState getTransactionState() {
		return transactionState;
	}

	public void setTransactionState(DistributedTransactionState transactionState) {
		this.transactionState = transactionState;
	}
	
	
}
